package l.l.w.tengxun._02;


import java.math.BigInteger;
import java.util.Scanner;

/**
 * Created by llw on 2018/4/5/0005.
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int k = in.nextInt();
        int a = in.nextInt();
        int x = in.nextInt();
        int b = in.nextInt();
        int y = in.nextInt();
        BigInteger result = BigInteger.valueOf(0l);
        for(int i = 0; i <= x; ++i){
            int sum = k - a * i;
            if(sum % b == 0){
                int j = sum / b;
                BigInteger t1 = get2(x, i);
                BigInteger t2 = get2(y, j);
                result= result.add(t1.multiply(t2).mod(BigInteger.valueOf(1000000007)));
                result = result.mod(BigInteger.valueOf(1000000007));
                int temp1 = get1(x,i);
                int temp2 = get1(y,j);

            }
        }
        System.out.println(result);
    }

    public static BigInteger get2(int a,int b){
        BigInteger up = BigInteger.valueOf(1l);
        BigInteger down = BigInteger.valueOf(1l);
        for(int i = b-1; i >= 0; --i){
            up = up.multiply(BigInteger.valueOf(a-i));
            down = down.multiply(BigInteger.valueOf(i+1));
        }
        return up.divide(down);
    }


    public static int get1(int a,int b){
        long up = 1;
        long down = 1;
        for(int i = b-1; i >= 0; --i) {
            up *= (a - i);
            if(up % (i+1) == 0){
                up = up / (i+1);
            }else{
                down = down * (i+1);
            }
        }
        long result = up /down;
        return (int)(result % 1000000007);
    }


    public static int get(int a, int b){
        long up = 1;
        long down = 1;
        for(int i = b-1; i >= 0; --i) {
            up *= (a - i);
            down *= (i + 1);
            long temp = down;
            if (up % down == 0) {
                up = up / down;
                down = 1;
            } else {
                temp = (long) Math.sqrt(down);
                for (long j = temp; j >= 2; ) {
                    if (up % down == 0) {
                        up = up / j;
                        down = down / j;
                        j = down;
                    } else {
                        j = j - 1;
                    }
                }
            }
        }
        return (int)(up % 1000000007);
    }
}
